package com.franklin.java.action.sql.entity.ui;

import com.franklin.plugins.common.collection.PrettyArrayList;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.ui.treeStructure.SimpleNode;

import java.util.Collections;
import java.util.List;

/**
 * @author Franklin
 * @since 2021/9/13 18:51
 */
public class PropertyNode extends ResultMapChildNode {

    private String key;
    private String value;

    protected PropertyNode(SimpleNode aParent, String key, String value) {
        super(aParent);
        this.key = key;
        this.value = value;
        setIcon(AllIcons.Nodes.Property);
        setProperties();
    }

    @Override
    protected void setProperties() {
        this.properties = new PrettyArrayList<>();
    }

    @Override
    public boolean isSingleTag() {
        return true;
    }

    @Override
    public List<String> getChildNodeNames() {
        return Collections.emptyList();
    }

    @Override
    public String getName() {
        return key + " = " + value;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
